fn main() {
    let mut post = Post::new();
    post.add_text("Who am i");
    post.add_text("I am a post");
    let post = post.request_review();
    let post = post.approve();
    assert_eq!("Who am iI am a post", post.content());
}

pub struct Post {
    contents: String,
}

impl Post {
    fn new() -> DraftPost {
        DraftPost {
            contents: String::from(""),
        }
    }
    fn content(&self) -> &str {
        &self.contents
    }
}

struct DraftPost {
    contents: String,
}

struct PendingReviewPost {
    contents: String,
}

impl DraftPost {
    fn add_text(&mut self, txt: &str) {
        self.contents.push_str(txt);
    }
    fn request_review(self) -> PendingReviewPost {
        PendingReviewPost {
            contents: self.contents,
        }
    }
}

impl PendingReviewPost {
    fn approve(self) -> Post {
        Post {
            contents: self.contents,
        }
    }
}
